package gld.algo.haluk;

import gld.*;
import gld.sim.*;
import gld.algo.tlc.*;
import gld.infra.*;
import gld.utils.*;
import gld.xml.*;

import java.io.IOException;
import java.util.* ;
import java.awt.Point;
public class TLCHaluk extends TLController{
	
	public static final String shortXMLName="HALUK";
	Junction[] juntions;
	Node[] nodes;
	Drivelane[] lanes;
	public TLCHaluk(Infrastructure infra){
		
		super(infra);
		nodes=infra.getAllNodes();
		
	}



	@Override
	public TLDecision[][] decideTLs() {
		// TODO Auto-generated method stub
		return null;
	}

	
	public void switchAllRed(){
		
		for(int i=0; i<nodes.length; i++){
			if(nodes[i].getType() == Node.JUNCTION){
				
				try {
					lanes=nodes[i].getInboundLanes();
				} catch (InfraException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();}
					
			for(int j=0; j<lanes.length; j++){
				   lanes[j].getSign().setState(true);
			}
				
			} 
	    }
	} 
	@Override
	public void updateRoaduserMove(Roaduser ru, Drivelane prevlane,
			Sign prevsign, int prevpos, Drivelane dlanenow, Sign signnow,
			int posnow, Drivelane[] possiblelanes, Point[] ranges,
			Drivelane desiredLane) {
		// TODO Auto-generated method stub
		
	}
	public XMLElement saveSelf () throws XMLCannotSaveException
	{ 	XMLElement result=super.saveSelf();
		result.setName(shortXMLName);
		return result;
	}
  
 	public String getXMLName ()
	{ 	return "HALUK";
	}
	
}
